import { createStore, applyMiddleware, compose } from 'redux'
import createSagaMiddleware from 'react-saga'
import reducer from './reducer'

const sagaMiddleware = createSagaMiddleware()

const composeEnhancers =
  window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({ trace: true }) || compose

const store = createStore(
  reducer,
  composeEnhancers(applyMiddleware(sagaMiddleware))
)
sagaMiddleware.run()

export default store
